package beanstao.util.type.base;

import java.lang.reflect.Array;
import java.util.Map;

import beanstao.util.Util;
import beanstao.util.exception.technical.util.reflect.FailToCastObjectException;
import beanstao.util.type.Castor;

@SuppressWarnings({ "rawtypes" })
public class Map2Array extends Castor<Map, Object>
{

	public Map2Array()
	{
		fromClass = Map.class;
		toClass = Array.class;
	}

	@Override
	public Object cast(Map src, Class<?> toType, String... args) throws FailToCastObjectException
	{
		return Util.collection2array(src.values(), toType.getComponentType());
	}

}
